package com.ty.user.starter.entity.dto;

import com.ty.user.starter.enums.MenuEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author minku
 * @since 2021-10-16
 */
@Data
public class MenuDto implements Serializable {

    private static final long serialVersionUID = 5130017169384466754L;

    @ApiModelProperty("id")
    private Long id;

    /**
     * 一级菜单parentId默认为0
     */
    @ApiModelProperty("父id")
    @NotNull(message = "父id不能为空")
    private Long parentId = 0L;

    @ApiModelProperty(value = "菜单名称", required = true)
    @NotBlank(message = "菜单名称不能为空")
    @Length(min = 1, max = 20, message = "菜单名称长度介于1~20位")
    private String name;

    @ApiModelProperty("链接")
    @Length(min = 1, max = 100, message = "链接长度介于1~100位")
    private String url;

    @ApiModelProperty("图标")
    @Length(min = 1, max = 20, message = "图标长度介于1~20位")
    private String icon;

    @ApiModelProperty(value = "排序", required = true)
    @NotNull(message = "排序值不能为空")
    @Range(min = 0, max = 100, message = "排序值介于1~100之间")
    private Integer sort = 0;

    @ApiModelProperty("备注")
    @Length(min = 1, max = 100, message = "备注长度介于1~100位")
    private String remark;

    @ApiModelProperty("状态")
    @NotNull(message = "状态不能为空")
    private Boolean state = true;

    @ApiModelProperty(value = "菜单类型(0:菜单;1:按钮)", required = true)
    @NotNull(message = "菜单类型不能为空")
    private MenuEnum menuType;

    @ApiModelProperty(value = "权限值")
    @Length(min = 1, max = 30, message = "权限值长度介于1~30位")
    private String perm;

}
